
package com.plian.system.service.fr.authorize.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.plian.system.entity.fr.authorize.AuthorizeValue;
import com.plian.system.mapper.fr.authorize.AuthorizeValueMapper;
import com.plian.system.service.fr.authorize.IAuthorizeColumnService;
import com.plian.system.service.fr.authorize.IAuthorizeLinkService;
import com.plian.system.service.fr.authorize.IAuthorizeValueService;
import lombok.AllArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

/**
 * 表格值 服务实现类
 *
 * @author panqb
 * @since 2022-01-07
 */
@Service
@AllArgsConstructor
public class AuthroizeValueServiceImpl extends ServiceImpl<AuthorizeValueMapper, AuthorizeValue> implements IAuthorizeValueService {

    /**
     * logger属性.
     */
    private static final Logger LOGGER  = LoggerFactory.getLogger(AuthroizeValueServiceImpl.class);

    private static final int END_INDEX = 5;

    private static final String TABLE_12 = "ta2021_12";

    private static final String[] LINE_1 = {"对外捐赠支出预算表", "", "", "", "", "", "", ""};

    private static final String[] LINE_2 = {"", "", "", "", "", "", "", "邢国资企预12表"};

    private static final String[] LINE_4 = {"序号", "捐赠单位", "捐赠依据", "受赠对象", "捐赠事由", "捐赠财产构成", "捐赠金额", "捐赠时间"};

    private static final String[] LINE_5 = {"栏次", "1", "2", "3", "4", "5", "6", "7"};

    private static final String[] LINE_LAST = {"    表内公式：6栏合计行=各浮动行之和。　　", "", "", "", "", "", "", ""};

    private static final String[] EMPTY_LINE = {"", "", "", "", "", "", "", ""};

    private IAuthorizeColumnService authorizeColumnService;

    private IAuthorizeLinkService authorizeLinkService;

    @Override
    public AuthorizeValue findValueByLinkId(String linkId, int lineNumber, String columnId) {
        return getOne(Wrappers.<AuthorizeValue>lambdaQuery().eq(AuthorizeValue::getLinkId, linkId)
                .eq(AuthorizeValue::getOrderNumber, lineNumber)
                .eq(AuthorizeValue::getColumnId, columnId)
                .orderByAsc(AuthorizeValue::getOrderNumber));
    }
}
